FROM eclipse-temurin:17-jdk-alpine as builder

WORKDIR laterem

ADD ./target/*.jar ./app.jar

RUN java -Djarmode=layertools -jar app.jar extract

FROM eclipse-temurin:17-jdk-alpine
MAINTAINER alan
WORKDIR laterem
COPY --from=builder laterem/dependencies/ ./

COPY --from=builder laterem/spring-boot-loader/ ./

COPY --from=builder laterem/snapshot-dependencies/ ./

COPY --from=builder laterem/application/ ./

EXPOSE 8080

ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]